<template>
  <Layout style="height: 100%;" class="main">
    <Header class="header-con">
      <header-bar :collapsed="collapsed">
        <user
          :user-name="userInfo.name"
          :user-type="userInfo.userType"
        />
      </header-bar>
    </Header>
    <Layout style="height: calc(100% - 64px);">
      <Content class="main-content-con1">
        <Row >
          <Col span="16" class="box">
          <Layout >
            <Header class="title" style="height:48px;line-height:48px;">
              工作台
            </Header>
            <Content class="content" style="padding:0 20px;">
              <Row :gutter="20">
                <Col span="8">
                  <div class="wenxun" style="background-color: #59D34B;">
                    <img src="../../assets/images/wenxun.png" alt="" style="width:34px; vertical-align:middle;">
                    问询：{{businessTypeNum}}项
                  </div>
                </Col>
                <Col span="8">
                  <div class="wenxun" style="background-color: #5ABBFB;">
                    <img src="../../assets/images/daiban.png" alt="" style="width:34px; vertical-align:middle;">
                    待办：{{todo}}项
                  </div>
                </Col>
                <Col span="8">
                  <div class="wenxun" style="background-color: #FA8588;">
                    <img src="../../assets/images/yuqi.png" alt="" style="width:34px; vertical-align:middle;">
                    逾期：{{overdue}}项
                  </div>
                </Col>
              </Row>
            </Content>
          </Layout>
          </Col>
          <Col span="8" class="box">
          <Layout >
            <Header class="title">
              最近使用
            </Header>
            <Content class="content" style="height:150px">
              <Row>
                <Col span="6" class="icon-Img" v-for="item in recentlyList" :key="item">
                  <div @click="jump(item.href)">
                    <img class="userImg" v-if="item.href == 'service-enquiries'" src="../../assets/images/wxhf.png" />
                    <img v-else :src="returnImg(item.href)"
                         class="userImg">
                    <div><span class="title-model">{{item.name}}</span></div>
                  </div>
                </Col>
              </Row>
            </Content>
          </Layout>
          </Col>
        </Row>
        <Row>
          <Col span="16" class="box1">
          <Layout >
            <Header class="title" style="height:48px;line-height:48px;">
              我的信息
            </Header>
            <Content class="content">
              <Tabs value="风险评估" v-model="businessType" @on-click="businessTypeTab(businessType)" class="tabs">
                <TabPane :label="businessType1" name="风险评估"></TabPane>
                <TabPane :label="businessType2" name="风险销号"></TabPane>
                <TabPane :label="businessType3" name="管控措施"></TabPane>
                <TabPane :label="businessType4" name="每月动态"></TabPane>
                <TabPane :label="businessType5" name="过程管控"></TabPane>
                <!-- <TabPane :label="businessType6" name="管理分析"></TabPane> -->
              </Tabs>
              <Row style="overflow: auto;height:180px;">
                <Col span="24">
                <List>
                  <ListItem  v-for="(item,index) in messageList.resultObject" style="padding: 5px 0;border-bottom: none;" :key="index">
                    <span style="width:65%;margin-left:46px;">{{item.messagePc}}</span><a style="margin-left:10px;" class="blue" @click="wxhref(item)">点击进入！</a>
                    <span style="float:right;margin-left:30px;">{{$time(new Date(item.createTime),'yyyy-MM-dd hh:mm:ss')}}</span>
                  </ListItem>
                </List>
                </Col>
              </Row>
              <Row type="flex" justify="center" v-if="messageList.resultObject.length > 0">
                <Col>
                <Page
                  class="pagination"
                  :total="parmes.totalRecord"
                  :page-size="parmes.pageSize"
                  :current="parmes.currentPage"
                  @on-change="pageChangeBuss"
                  show-elevator
                  show-total
                />
                </Col>
              </Row>
            </Content>
          </Layout>
          </Col>
          <Col span="8" class="box1">
          <Layout>
            <Header class="title">
              常用功能
            </Header>
            <Content class="content" style="height:373px">
              <Row>
                <Col span="6" class="icon-Img" v-for="(item,index) in menuRecordList" :key="index">
                <div @click="jump(item.href)">
                  <img class="userImg" v-if="item.href == 'service-enquiries'" src="../../assets/images/wxhf.png" />
                  <img v-else :src="returnImg(item.href)"
                       class="userImg">
                  <div><span class="title-model">{{item.name}}</span></div>
                </div>
                </Col>
                <Col span="6" class="icon-Img" >
                  <a>
                    <div @click="system()">
                      <img :src="addActive"
                           class="userImg">
                      <div><span class="title-model">更多功能</span></div>
                    </div>
                  </a>
                </Col>
              </Row>
            </Content>
          </Layout>
          </Col>
        </Row>
        <Row>
          <Col span="16" class="box1">
          <Layout >
            <Header class="title" style="height:48px;line-height:48px;">
              待办提醒
            </Header>
            <Content class="content">
              <Tabs value="风险评估" v-model="active" @on-click="activeTab(active,0)" class="tabs">
                <TabPane :label="tabs1" name="风险评估"></TabPane>
                <TabPane :label="tabs2" name="风险销号"></TabPane>
                <TabPane :label="tabs3" name="管控措施"></TabPane>
                <TabPane :label="tabs4" name="每月动态"></TabPane>
                <TabPane :label="tabs5" name="过程管控"></TabPane>
              </Tabs>
              <Row style="overflow: auto;height:150px;">
                <Col span="24">
                <div  v-for="(item,index) in pointList1" :key="index">
                  <Button :class="{blue:checkBtn===index}" @click="checkPoint(item.appPoint,0,index)" style="margin-left:60px;margin-right:20px;float:left;">{{item.appPoint}}：{{item.count}}项</Button>
                </div>
                </Col>
                <Col span="24">
                <List v-show="contentList1.length>0">
                  <ListItem  v-for="(item,index) in contentList1" style="padding: 5px 0;border-bottom: none;" :key="index">
                    <span style="width:70%;margin-left:100px;">{{item.messagePc}},<a class="blue" @click="href(item)">点击进入！</a></span>
                    <div>
                      <img style="float:right;" :src="checkLevel(item.level)">
                    </div>
                    <div>
                      <span style="float:left;padding-left:80px;">{{item.createTime}}</span>
                    </div>
                  </ListItem>
                </List>
                </Col>
              </Row>
              <Row type="flex" justify="center" v-show="contentList1.length>0">
                <Col>
                <Page
                  class="pagination"
                  :total="page.total"
                  :page-size="page.pageSize"
                  :current="page.currentPage"
                  @on-change="pageChange"
                  show-elevator
                  show-total
                />
                </Col>
              </Row>
            </Content>
          </Layout>
          </Col>
          <Col span="8" class="box1">
          <!-- <Layout>
            <Header class="title">
              常用功能
            </Header>
            <Content class="content" style="height:373px">
              <Row>
                <Col span="6" class="icon-Img" v-for="item in menuRecordList" :key="item">
                <div @click="jump(item.href)">
                  <img :src="returnImg(item.href)"
                       class="userImg">
                  <div><span class="title-model">{{item.name}}</span></div>
                </div>
                </Col>
                <Col span="6" class="icon-Img" >
                <div @click="system()">
                  <img :src="addActive"
                       class="userImg">
                  <div><span class="title-model">更多功能</span></div>
                </div>
                </Col>
              </Row>
            </Content>
          </Layout> -->
          <Layout>
            <Header class="title">
              待办四色分布
            </Header>
            <Content class="content" >
              <v-chart ref="e1" :style="{width:'100%',height: '300px',}" :options="options" :auto-resize="true"></v-chart>
            </Content>
          </Layout>
          </Col>
        </Row>
        <Row >
          <Col span="16" class="box1">
          <Layout >
            <Header class="title" style="height:48px;line-height:48px;">
              逾期提醒
            </Header>
            <Content class="content">
              <Tabs value="风险评估" v-model="active1" @on-click="activeTab(active1,1)" class="tabs">
                <TabPane :label="tabs6" name="风险评估"></TabPane>
                <TabPane :label="tabs7" name="风险销号"></TabPane>
                <TabPane :label="tabs8" name="管控措施"></TabPane>
                <TabPane :label="tabs9" name="每月动态"></TabPane>
                <TabPane :label="tabs10" name="过程管控"></TabPane>
              </Tabs>
              <Row style="overflow: auto;height:180px;">
                <Col span="24">
                <div  v-for="(item,index) in pointList2" :key="index">
                  <Button :class="{blue:checkBtn1===index}" @click="checkPoint(item.appPoint,1,index)" style="margin-left:60px;margin-right:20px;float:left;">{{item.appPoint}}：{{item.count}}项</Button>
                </div>
                </Col>
                <Col span="24">
                <List v-show="contentList2.length>0">
                  <ListItem  v-for="item in contentList2" :key="item" style="padding: 5px 0;border-bottom: none">
                    <span style="width:70%;margin-left:100px;font-size:14px;">{{item.messagePc}}</span>
                    <div>
                      <span style="float:left;padding-left:80px;">{{item.overdueTime}}</span>
                    </div>
                  </ListItem>
                </List>
                </Col>
              </Row>
              <Row type="flex" justify="center" v-show="contentList2.length>0">
                <Col>
                <Page
                  class="pagination"
                  :total="page1.total"
                  :page-size="page1.pageSize"
                  :current="page1.currentPage"
                  @on-change="pageChange1"
                  show-elevator
                  show-total
                />
                </Col>
              </Row>
            </Content>
          </Layout>
          </Col>
          <Col span="8" class="box1">
            <div style="background-color: #F7F7F7;">
                <span style=" font-weight:bold;color:#697786;font-size:12px;padding-left:5px;">逾期分布</span>
                <v-chart ref="e2" :style="{width:'100%',height: '320px',}" :options="options1" :auto-resize="true"></v-chart>
            </div>
          </Col>
        </Row>
      </Content>
    </Layout>
    <Modal
      v-model="modal1"
      title="常用功能编辑"
      @on-ok="ok"
      @on-cancel="cancel">
      <Layout class="content">
        <Sider class="content" style="min-width:245px">
          <div class="title-size">
            <span >
              全部功能
            </span>
          </div>
          <div class="col-height100">
            <Tree :data="tree" expand @on-select-change="treeClick"></Tree>
          </div>
        </Sider>
        <Content class="content">
          <div class="title-size">
            <span>
              常用功能（最多7个）
            </span>
          </div>
          <div class="col-height100">
            <List border v-show="checkMenuList.length>0">
              <ListItem  v-for="(item,index) in checkMenuList" :key="index">
                <span style="width:50%">{{item.name}}</span>
                <div class="delete-Img">
                  <img style="float:left;" @click="deleteRecord(index)" :src="deleteImg">
                </div>
              </ListItem>
            </List>
          </div>
        </Content>
      </Layout>
    </Modal>
  </Layout>
</template>

<script>
  import HeaderBar from '%/modules/home/header-bar'
  import TagsNav from '%/modules/home/tags-nav'
  import User from '%/modules/home/user/workUser'
  import {
    getNewTagList,
    routeEqual,
    getMenuInLocalstorage,
    getUserInLocalstorage
  } from '@/libs/util'
  import yuqi from '@/assets/images/yuqi.svg'
  import daiban from '@/assets/images/daiban.svg'
  import anquanfengxian from '@/assets/images/anquanfengxian.svg'
  import caidanguanli from '@/assets/images/caidanguanli.svg'
  import caozuorizhi from '@/assets/images/caozuorizhi.svg'
  import cuoshifanganku from '@/assets/images/cuoshifanganku.svg'
  import cuoshifangantaizhang from '@/assets/images/cuoshifangantaizhang.svg'
  import diaodugangpeizhi from '@/assets/images/diaodugangpeizhi.svg'
  import dongtaibianshitaizhang from '@/assets/images/dongtaibianshitaizhang.svg'
  import dongtaiguankong from '@/assets/images/dongtaiguankong.svg'
  import dongtaiguankongbiao from '@/assets/images/dongtaiguankongbiao.svg'
  import dudaobaogao from '@/assets/images/dudaobaogao.svg'
  import fangantaizhang from '@/assets/images/fangantaizhang.svg'
  import fengxianbianshi from '@/assets/images/fengxianbianshi.svg'
  import fengxiantaizhang from '@/assets/images/fengxiantaizhang.svg'
  import fengxianxiaohao from '@/assets/images/fengxianxiaohao.svg'
  import fengxianxiaohaotaizhang from '@/assets/images/fengxianxiaohaotaizhang.svg'
  import fengxianxinxiku from '@/assets/images/fengxianxinxiku.svg'
  import gongdiantaizhang from '@/assets/images/gongdiantaizhang.svg'
  import gongsijigou from '@/assets/images/gongsijigou.svg'
  import gongsirenyuanchaxun from '@/assets/images/gongsirenyuanchaxun.svg'
  import gongsirenyuan from '@/assets/images/gongsirenyuan.svg'
  import guankongcuoshi from '@/assets/images/guankongcuoshi.svg'
  import guochengguankong from '@/assets/images/guochengguankong.svg'
  import jueseguanli from '@/assets/images/jueseguanli.svg'
  import meiyuedongtai from '@/assets/images/meiyuedongtai.svg'
  import renyuanchaxun from '@/assets/images/renyuanchaxun.svg'
  import shujuzidian from '@/assets/images/shujuzidian.svg'
  import xiangmuchaxun from '@/assets/images/xiangmuchaxun.svg'
  import xiangmurenyuan from '@/assets/images/xiangmurenyuan.svg'
  import xiangmujinglibu from '@/assets/images/xiangmujinglibu.svg'
  import xiangmuxinxi from '@/assets/images/xiangmuxinxi.svg'
  import yonghuguanli from '@/assets/images/yonghuguanli.svg'
  import yujingpeizhi from '@/assets/images/yujingpeizhi.svg'
  import yujingtongji from '@/assets/images/yujingtongji.svg'
  import zhiwuguanli from '@/assets/images/zhiwuguanli.svg'
  import zongtibianshitaizhang from '@/assets/images/zongtibianshitaizhang.svg'
  import addActive from '@/assets/images/add.svg'
  import deleteImg from '@/assets/images/delete.svg'
  import level1 from '@/assets/images/level1.svg'
  import level2 from '@/assets/images/level2.svg'
  import level3 from '@/assets/images/level3.svg'
  import level4 from '@/assets/images/level4.svg'

  export default {
    name: 'Work',
    components: {
      HeaderBar,
      TagsNav,
      User
    },
    data() {
      return {
        daiban,
        yuqi,
        anquanfengxian,
        caidanguanli,
        caozuorizhi,
        cuoshifanganku,
        cuoshifangantaizhang,
        diaodugangpeizhi,
        dongtaibianshitaizhang,
        dongtaiguankong,
        dongtaiguankongbiao,
        dudaobaogao,
        fangantaizhang,
        fengxianbianshi,
        fengxiantaizhang,
        fengxianxiaohao,
        fengxianxiaohaotaizhang,
        fengxianxinxiku,
        gongdiantaizhang,
        gongsijigou,
        gongsirenyuan,
        gongsirenyuanchaxun,
        guankongcuoshi,
        guochengguankong,
        jueseguanli,
        meiyuedongtai,
        renyuanchaxun,
        xiangmurenyuan,
        xiangmuchaxun,
        shujuzidian,
        xiangmuxinxi,
        xiangmujinglibu,
        yonghuguanli,
        yujingpeizhi,
        yujingtongji,
        zhiwuguanli,
        zongtibianshitaizhang,
        addActive,
        deleteImg,
        level1,
        level2,
        level3,
        level4,
        num1:0,
        num2:0,
        num3:0,
        num4:0,
        num5:0,
        num6:0,
        num7:0,
        num8:0,
        num9:0,
        num10:0,
        tabs1:'',
        tabs2:'',
        tabs3:'',
        tabs4:'',
        tabs5:'',
        tabs6:'',
        tabs7:'',
        tabs8:'',
        tabs9:'',
        tabs10:'',
        businessType1:'',
        businessType2:'',
        businessType3:'',
        businessType4:'',
        businessType5:'',
        businessType6:'',
        businessTypeNum:'',
        levelnum1:0,
        levelnum2:0,
        levelnum3:0,
        levelnum4:0,
        todo:0,//代办
        overdue:0,//逾期
        modal1:false,
        collapsed: false,
        recentlyList:[],
        menuList: [],
        userInfo: {},
        checkBtn:0,
        checkBtn1:0,
        bianshiNum:0,
        active:'风险评估',
        active1:'风险评估',
        businessType:'风险评估',
        userDetail:JSON.parse(localStorage.getItem('userList')),
        personType:JSON.parse(localStorage.getItem('personType')),
        daishenNum:0,
        options: {},
        menuRecordList:[],
        tree:[],
        pointList1:[],
        checkPoint1:'',
        pointList2:[],
        checkPoint2:'',
        checkMenuList:[],
        page:{
        currentPage: 1,
        pageSize: 5,
        total:0,
        },
        page1:{
          currentPage: 1,
          pageSize: 5,
          total:0,
        },
        contentList1:[],
        contentList2:[],
        messageList:{},
        parmes:{
          totalRecord:0,
          currentPage:1,
          pageSize:10,
          whereMap:{
            businessType:'',
            stage:0,
            dataType:0,
            appId:'pc',
          }
        },
        options1:{},    // 逾期分布图对象
        objData:{},
      }
    },
    methods: {
      // 销号统计
      statOverdueLevelCount(){
          let params = {
            userId:this.userDetail.userOrgId
          }
          this.$api.statisticsAnalysis.statOverdueLevelCount(params).then(resp=>{
              if(resp.code == 200){
                  this.objData = resp.data
                  if(this.objData.total > 999){
                    this.objData.total = `999+`
                  }
                  this.pieChart9()
              }
          })
      },
      // 逾期分布饼图
      pieChart9(){
          let self = this,legendData = [],seriesData = [],colorArr = ['#53CAEB','#47A8EE','#789DF5','#A8C3F7','#4291CB']
          self.objData.list.forEach((e,index)=>{
              let obj = {
                  value:e.count,
                  name:e.module,
                  itemStyle:{
                      color:colorArr[index]
                  }
              }
              legendData.push(e.module)
              seriesData.push(obj)
          })
          this.options1 = {
              title: {
                  // text: `总数:${self.objData.total}`,
                  // top: 'center',
                  // left: '212',
                  // textAlign: 'center',
              },
              tooltip: {
                  trigger: 'item',
                  formatter: '{a} <br/>{b} : {c} ({d}%)'
              },
              legend: {
                  bottom: 10,
                  data: legendData,
                  formatter: function (name) {
                      if (name.length > 4) {
                          name =  name.slice(0,3) + '...';
                      }
                      return name
                  },
              },
              series: [
                  {
                      name: '风险类型',
                      type: 'pie',
                      radius: ['32%', '50%'],//设置饼图大小
                      center: ['50%', '50%'],//设置饼图位置
                      avoidLabelOverlap: false,
                      label: {
                          normal: {
                              show: false,
                              position: 'center'
                          },
                          emphasis: {
                              show: true,
                              textStyle: {
                                  fontSize: '0',
                                  fontWeight: 'bold'
                              }
                          }
                      },
                      labelLine: {
                          normal: {
                              show: false
                          }
                      },
                      data: seriesData
                  }
              ]
          }
      },
      // 问询点击进入跳转
      wxhref(item){
        let parmes = {
          id:item.id,
          isRead:1
        }
        this.$api.messageManage.messageUpdateStatus(parmes).then(resp => {
          if(resp.code){}
        })
        if(item.businessType == 'businesstype_identification'){     // 风险辨识
                this.$router.push({
                    name:'replyInquiries-detail',
                    query:{
                        source:'1',
                        businessType:item.businessType,
                        objectId:'',
                        id:item.questionId,
                        riskName:item.riskName
                    }
                })
            }else if(item.businessType == 'businesstype_measures'){     // 管控措施
                this.$router.push({
                    name:'replyInquiries-detail',
                    query:{
                        source:'1',
                        businessType:item.businessType,
                        objectId:'',
                        id:item.questionId,
                        riskName:item.riskName
                    }
                })
            }else if(item.businessType == 'businesstype_elimination'){     // 风险销号
                this.$router.push({
                    name:'replyInquiries-detail',
                    query:{
                        source:'1',
                        businessType:item.businessType,
                        objectId:'',
                        id:item.questionId,
                        riskName:item.riskName
                    }
                })
            }else if(item.businessType == 'businesstype_dynamics'){      // 每月动态
                this.$router.push({
                    name:'replyInquiries-detail',
                    query:{
                        source:'1',
                        businessType:item.businessType,
                        objectId:'',
                        id:item.questionId,
                        riskName:item.riskName
                    }
                })
            }else if(item.businessType == 'businesstype_control'){     // 过程管控
                this.$router.push({
                    name:'replyInquiries-detail',
                    query:{
                        source:'1',
                        businessType:item.businessType,
                        objectId:'',
                        id:item.questionId,
                        riskName:item.riskName
                    }
                })
            }
      },
      // 业务问询消息详情列表
      messageDetailList(type){
        this.parmes.whereMap.businessType = type
        this.$api.messageManage.messageDetailList(this.parmes).then(resp=>{
          if(resp.code == 200){
            this.messageList = resp.data
            this.parmes.totalRecord = resp.data.totalRecord
          }
        })
      },
      // pc端业务问询-各业务类型未处理消息总数
      noReadBusinessTypeCount(){
        let parmes = {
          dataType:0,
          stage:0,
          appId:'pc'
        }
        this.$api.messageManage.noReadBusinessTypeCount(parmes).then(resp=>{
          if(resp.code == 200){
            this.businessTypeNum = resp.data.count ? resp.data.count : 0
            this.businessType1 = `风险评估：${resp.data.businesstype_identification ? resp.data.businesstype_identification : 0}项`
            this.businessType2 = `风险销号：${resp.data.businesstype_elimination ? resp.data.businesstype_elimination : 0}项`
            this.businessType3 = `管控措施：${resp.data.businesstype_measures ? resp.data.businesstype_measures : 0}项`
            this.businessType4 = `每月动态：${resp.data.businesstype_dynamics ? resp.data.businesstype_dynamics : 0}项`
            this.businessType5 = `过程管控：${resp.data.businesstype_control ? resp.data.businesstype_control : 0}项`
            // this.businessType6 = `管理分析：0项`
          }
        })
      },
      //  tab切换
      businessTypeTab(type){
        if(type == '风险销号'){
          this.messageDetailList('businesstype_elimination')
        }else if(type == '风险评估'){
          this.messageDetailList('businesstype_identification')
        }else if(type == '管控措施'){
          this.messageDetailList('businesstype_measures')
        }else if(type == '每月动态'){
          this.messageDetailList('businesstype_dynamics')
        }else if(type == '过程管控'){
          this.messageDetailList('businesstype_control')
        }
      },
      //获取最近使用
      getRecentlyUseList() {
        let data = {
          currentPage:1,
          pageSize:4,
          whereMap:{}
        }
        this.$api.homeConterller.getRecentlyUseList(data).then(res => {
          if(res.code == 200){
            this.recentlyList = res.data;
            console.log(this.recentlyList)
          }
        })
      },
      //获取常用功能
      getMenuRecord(){
        this.$api.homeConterller.getMenuRecord().then(res => {
          if(res.code == 200){
            this.menuRecordList = res.data;
            console.log(this.menuRecordList)
          }
        })
      },
      //获取功能树状结构
      getMenuTree(){
        this.$api.homeConterller.getMenuTree().then(res => {
          if(res.code == 200){
            this.tree = res.data;
          }
        })
      },
      returnImg(href){
        if('enterprise-info' === href){
          return gongsijigou;
        }else if('enterprise-person' === href){
          return gongsirenyuan;
        }else if('project-info' === href){
          return xiangmuxinxi;
        }else if('project-team' === href){
          return xiangmujinglibu;
        }else if('project-person' === href){
          return xiangmurenyuan;
        }else if('workstation-ledger' === href){
          return gongdiantaizhang;
        }else if('search-project' === href){
          return xiangmuchaxun;
        }else if('search-enterprise-person' === href){
          return gongsirenyuanchaxun;
        }else if('search-project-person' === href){
          return renyuanchaxun;
        }else if('user-management' === href){
          return yonghuguanli;
        }else if('job-management' === href){
          return zhiwuguanli;
        }else if('role-management' === href){
          return jueseguanli;
        }else if('dict-management' === href){
          return shujuzidian;
        }else if('menu-management' === href){
          return caidanguanli;
        }else if('operation-log' === href){
          return caozuorizhi;
        }else if('dispatch-post' === href){
          return diaodugangpeizhi;
        }else if('early-warning' === href){
          return yujingpeizhi;
        }else if('risk-information-labrary' === href){
          return fengxianxinxiku;
        }else if('measures-library' === href){
          return cuoshifanganku;
        }else if('risk-identification' === href){
          return fengxianbianshi;
        }else if('management-and-measures' === href){
          return guankongcuoshi;
        }else if('monthly-dynamics' === href){
          return meiyuedongtai;
        }else if('procedure-control' === href){
          return guochengguankong;
        }else if('general-identification-ledger' === href){
          return zongtibianshitaizhang;
        }else if('dynamic-identification-ledger' === href){
          return dongtaibianshitaizhang;
        }else if('risk-identification-ledger' === href){
          return fengxianxiaohaotaizhang;
        }else if('measures-ledger' === href){
          return cuoshifangantaizhang;
        }else if('dynamic-control-ledger' === href){
          return dongtaiguankongbiao;
        }else if('statistics-dynamics' === href){
          return dongtaiguankong;
        }else if('statistics-measures' === href){
          return yujingtongji;
        }else if('dynamic-supervision-report' === href){
          return dudaobaogao;
        }else if('statistics-risk-detail' === href){
          return anquanfengxian;
        }else if('risk-elimination' === href){
          return fengxianxiaohao;
        }else if('service-enquiries-detail' === href){
          return anquanfengxian;
        }
      },
      jump(href){
        let data = {
            menuHref:href
        }
        this.$api.homeConterller.recentlyUseAdd(data).then(res => {
        })
        this.$router.push({
          name: href,
        })
      },
      newTabs(){
        this.tabs1 = '风险评估：'+this.num1+'项';
        this.tabs2 = '风险销号：'+this.num2+'项';
        this.tabs3 = '管控措施：'+this.num3+'项';
        this.tabs4 = '每月动态：'+this.num4+'项';
        this.tabs5 = '过程管控：'+this.num5+'项';
      },
      newTabs1(){
        this.tabs6 = '风险评估：'+this.num6+'项';
        this.tabs7 = '风险销号：'+this.num7+'项';
        this.tabs8 = '管控措施：'+this.num8+'项';
        this.tabs9 = '每月动态：'+this.num9+'项';
        this.tabs10 = '过程管控：'+this.num10+'项';
      },
      system(){
        this.$api.homeConterller.getMenuRecord().then(res => {
          if(res.code == 200){
            this.checkMenuList = res.data;
          }
        })
        this.modal1 = true;
      },
      treeClick(data){
        if(data.length>0){
          let idList = [];
          if(this.checkMenuList.length == 7){
            this.$Message.warning('最多选择7个常用功能');
            return;
          }
          if(this.checkMenuList.length>0){
            this.checkMenuList.forEach(item=>{
              idList.push(item.id);
            })
          }

          if(data[0].children.length == 0){
            if(idList.indexOf(data[0].id) === -1){
              this.checkMenuList.push(data[0]);
            }

          }
        }
      },
      deleteRecord(item){
        this.checkMenuList.splice(item, 1)
      },
      ok(){
        if(this.checkMenuList.length>0){
          let data = {
            content:this.checkMenuList
          }
          this.$api.homeConterller.saveMenu(data).then(res => {
            if(res.code == 200){
              this.$Message.success('保存成功');
              this.getMenuRecord();
              this.modal1 = false;
            }
          })
        }else if(this.checkMenuList.length == 0){
          let data = {
            content:[],
          }
          this.$api.homeConterller.saveMenu(data).then(res => {
            if(res.code == 200){
              this.$Message.success('保存成功');
              this.getMenuRecord();
              this.modal1 = false;
            }
          })
        }

      },
      activeTab(moudle,code){
        let userId = this.userInfo.userOrgId;
        if(code == 0){
          this.checkBtn = 0;
          this.active = moudle;
          this.getPoint(this.active,0,userId);
        }else{
          this.checkBtn1 = 0;
          this.active1 = moudle;
          this.getPoint(this.active1,1,userId);
        }

      },
      getChart(){
        let userId = this.userInfo.userOrgId;
        this.$api.homeConterller.getChart(userId).then(res => {
          if(res.code == 200){
            this.levelnum1 = res.data.level1;
            this.levelnum2 = res.data.level2;
            this.levelnum3 = res.data.level3;
            this.levelnum4 = res.data.level4;
            this.drawLine1()
          }
        })
      },
      drawLine1(){
        this.options = {
          xAxis: {
            data: ["蓝色预警","黄色预警","橙色预警","红色预警"],
            axisLine:{       //y轴
                show:false
            },
            axisTick:{       //y轴刻度线
                show:false
            },
          },
          yAxis: {
            axisLine:{       //y轴
                show:false
            },
            axisTick:{       //y轴刻度线
                show:false
            },
          },

          series: [{
            itemStyle: {
              normal: {
                color: function(params) {
                  var colorList = ["#3F4ABC", "#F6C638", "#F49661", "#F10019"];
                  return colorList[params.dataIndex]
                },
                //以下为是否显示，显示位置和显示格式的设置了
                label: {
                  show: true,
                  position: 'top',
                  formatter: '{c}'
                }
              }
            },
            type: 'bar',
            data: [this.levelnum1, this.levelnum2, this.levelnum3, this.levelnum4],
            barWidth : 25,//柱图宽度
          }]
        }
      },
      cancel(){
        this.checkMenuList = [];
        this.modal1 = false;
      },
      //获取消息数量
      getMessageNum(){
        let userId = this.userInfo.userOrgId;
        this.$api.homeConterller.getMessageNum(userId).then(res => {
          if(res.code == 200){
            this.todo = res.data.todoTotal;
            this.overdue = res.data.overdueTotal;
            this.$api.homeConterller.getMessages(userId,0).then(res => {
              if(res.code == 200){
                this.num1 = res.data[0].count;
                this.num2 = res.data[1].count;
                this.num3 = res.data[2].count;
                this.num4 = res.data[3].count;
                this.num5 = res.data[4].count;
                this.newTabs();
                this.getPoint(this.active,0,userId);
              }
            })
            this.$api.homeConterller.getMessages(userId,1).then(res => {
              if(res.code == 200){
                this.num6 = res.data[0].count;
                this.num7 = res.data[1].count;
                this.num8 = res.data[2].count;
                this.num9 = res.data[3].count;
                this.num10 = res.data[4].count;
                this.newTabs1();
                this.getPoint(this.active1,1,userId);
              }
            })

          }
        })
      },
      getPoint(data,code,userId){
        this.$api.homeConterller.getPoint(data,code,userId).then(res => {
          if(res.code == 200){
            if(code == 0){
              this.pointList1 = res.data;
              this.checkPoint1 =this.pointList1[0].appPoint
              this.getContentList(this.active,this.checkPoint1,'0');
            }else{
              this.pointList2 = res.data;
              this.checkPoint2 =this.pointList2[0].appPoint
              this.getContentList(this.active1,this.checkPoint2,'1');
            }

          }
        })
      },
      checkPoint(point,code,index){
        if(code == 0){
          this.checkPoint1 = point;
          this.checkBtn = index;
          this.page.currentPage = 1;
          this.getContentList(this.active,this.checkPoint1,'0');
        }else{
          this.checkPoint2 = point;
          this.checkBtn1 = index;
          this.page1.currentPage = 1;
          this.getContentList(this.active1,this.checkPoint2,'1');
        }
      },
      getContentList(module,point,status){

        let data = {
          whereMap:{
            module:module,
            appPoint:point,
            status:status,
            userId:this.userInfo.userOrgId
          }
        }
        if(status == 0){
            data.currentPage = this.page.currentPage
            data.pageSize = this.page.pageSize
        }else{
            data.currentPage = this.page1.currentPage
            data.pageSize = this.page1.pageSize
        }
        this.$api.homeConterller.getContentList(data).then(res => {
          if(res.code == 200){
            if(status == '0'){
              this.contentList1 = res.data.resultObject;
              this.page.total = res.data.totalRecord
              this.page.totalPage = res.data.totalPages
              this.contentList1.forEach(item=>{
                item.createTime = this.$time(new Date(item.createTime),'yyyy-MM-dd hh:mm:ss')
              })
            }else{
              this.contentList2 = res.data.resultObject;
              this.page1.total = res.data.totalRecord
              this.page1.totalPage = res.data.totalPages
              this.contentList2.forEach(item=>{
                item.overdueTime = this.$time( new Date(item.overdueTime),'yyyy-MM-dd hh:mm:ss')
              })
            }

          }
        })
      },
      checkLevel(level) {
        if (level == 1) {
          return level3;
        } else if (level == 2) {
          return level4;
        } else if (level == 3) {
          return level2;
        } else if (level == 4) {
          return level1;
        }
      },
      pageChangeBuss(current){
        this.parmes.currentPage = current
        if(this.businessType == '风险销号'){
          this.messageDetailList('businesstype_elimination')
        }else if(this.businessType == '风险评估'){
          this.messageDetailList('businesstype_identification')
        }else if(this.businessType == '管控措施'){
          this.messageDetailList('businesstype_measures')
        }else if(this.businessType == '每月动态'){
          this.messageDetailList('businesstype_dynamics')
        }else if(this.businessType == '过程管控'){
          this.messageDetailList('businesstype_control')
        }
      },
      pageChange(current) {
        this.page.currentPage = current
        this.getContentList(this.active,this.checkPoint1,'0')
      },
      pageChange1(current) {
        this.page1.currentPage = current
        this.getContentList(this.active1,this.checkPoint2,'1')
      },
      href(item){
        if(this.active == '风险评估'){
            let id = item.businessId;
          if(this.checkPoint1 == '待修订'){
              let data = {
                  businessId:id,
                  checkType:103,
                  tableType:1,
                  remindType:1
              }
              this.$api.homeConterller.jumpCheck(data).then(res => {
                  if(res.code == 200){
                      this.$router.push({
                          name: 'risk-identification-revise-edit',
                          params: {
                              id
                          }
                      })
                  }else{
                      this.$Message.error('权限变更，您已无法操作。');
                  }
              })

          }else{
              if(item.point == '总体辨识'){
                  let data = {
                      businessId:id,
                      checkType:101,
                      tableType:1,
                      remindType:1
                  }
                  this.$api.homeConterller.jumpCheck(data).then(res => {
                      if(res.code == 200){
                          this.$router.push({
                              name: `risk-identification-add`,
                              params: {
                                  type:1,
                                  project:item.businessId
                              }
                          })
                      }else{
                          this.$Message.error('权限变更，您已无法操作。');
                      }
                  })
              }else if(item.point == '动态辨识'){
                  let data = {
                      businessId:id,
                      checkType:102,
                      tableType:1,
                      remindType:1
                  }
                  this.$api.homeConterller.jumpCheck(data).then(res => {
                      if(res.code == 200){
                          this.$router.push({
                              name: `risk-identification-add`,
                              params: {
                                  type:2,
                                  project:item.businessId
                              }
                          })
                      }else{
                          this.$Message.error('权限变更，您已无法操作。');
                      }
                  })
              }

          }
        }else if(this.active == '风险销号'){
            if(this.checkPoint1 == '待审核'){
                let data = {
                    businessId: item.businessId,
                    checkType:302,
                    tableType:3,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'examine';
                        let id = item.businessId;
                        let name ='销号审核';
                        this.$router.push({
                            name: 'risk-elimination-examine',
                            params:{
                                type:type,
                                id:id,
                                name:name
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })

            }else if(this.checkPoint1 == '待销号'){
                let data = {
                    businessId: item.businessId,
                    checkType:301,
                    tableType:3,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let id = item.businessId;
                        this.$router.push({
                            name: `risk-elimination`,
                            params:{
                                id:id,
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })

            }else if(this.checkPoint1 == '待签发'){
                let data = {
                    businessId: item.businessId,
                    checkType:303,
                    tableType:3,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'issue';
                        let id = item.businessId;
                        let name ='销号签发';
                        this.$router.push({
                            name: 'risk-elimination-issue',
                            params:{
                                type:type,
                                id:id,
                                name:name
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })
            }else if(this.checkPoint1 == '配置'){
                let data = {
                    businessId: item.businessId,
                    checkType:304,
                    tableType:3,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'dispose';
                        let id = 1;
                        let name ='销号配置';
                        this.$router.push({
                            name:'risk-elimination-dispose',
                            params:{
                                type:type,
                                id:id,
                                name:name
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })
            }else{
                this.$router.push({
                    name: `risk-elimination`,
                })
            }
        }else if(this.active == '管控措施'){
            if(this.checkPoint1 == '待制定'){
                let data = {
                    businessId: item.businessId,
                    checkType:201,
                    tableType:2,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'makeMeasure';
                        let id = item.businessId;
                        let level = item.riskLevel;
                        let name ='方案制定';
                        this.$router.push({
                            name: `make-measures-add`,
                            params:{
                                type:type,
                                id:id,
                                level:level,
                                name:name
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })
            }else if(this.checkPoint1 == '待修订'){
                let data = {
                    businessId: item.businessId,
                    checkType:204,
                    tableType:2,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'editMeasure';
                        let id = item.businessId;
                        let level = item.riskLevel;
                        let name ='方案详情';
                        this.$router.push({
                            name: `make-measures-edit`,
                            params:{
                                type:type,
                                id:id,
                                level:level,
                                name:name
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })

            }else if(this.checkPoint1 == '待审核'){
                let data = {
                    businessId: item.businessId,
                    checkType:202,
                    tableType:2,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'examine';
                        let id = item.businessId;
                        let status = 8;
                        let name ='审核';
                        this.$router.push({
                            name: `management-and-measures-examine`,
                            params:{
                                type:type,
                                id:id,
                                status:status,
                                name:name
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })

          }else if(this.checkPoint1 == '待签发'){
                let data = {
                    businessId: item.businessId,
                    checkType:203,
                    tableType:2,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'issue';
                        let id = item.businessId;
                        let status = 0;
                        let name ='签发';
                        this.$router.push({
                            name: `management-and-measures-issue`,
                            params:{
                                type:type,
                                id:id,
                                status:status,
                                name:name
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })
          }else{
                let data = {
                    businessId: item.businessId,
                    checkType:205,
                    tableType:2,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        this.$router.push({
                            name: `management-and-measures`,
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })
          }

        }else if(this.active == '每月动态'){
            if(this.checkPoint1 == '待创建'){
                let data = {
                    businessId: item.businessId,
                    checkType:401,
                    tableType:4,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let objectId = ''
                        if(this.personType == 1 ){
                           objectId = this.userDetail.enterpriseId
                        }
                        if(this.personType == 2){
                           objectId = this.userDetail.enterpriseId
                        }
                        if(this.personType == 3){
                           objectId = this.userDetail.projectTeamId
                        }
                        this.$router.push({
                            name:'dynamics-add',
                            params:{
                                type:'add',
                                id:objectId,
                                name:'下月动态新增'
                            },
                            query:{
                                proId:item.projectId,
                            }
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })

            }else if(this.checkPoint1 == '待审核'){
                let type = 'examine';
                let id = item.businessId;
                let status = 1;
                let name ='每月动态审核';
                this.$router.push({
                    name: 'monthly-examine',
                    params:{type,id:id,name},
                    query:{isIssue:status,proName:item.projectName,dynamicRiskOrderListName:item.riskName},
                })
            }else if(this.checkPoint1 == '待签发'){
                let type = 'issue';
                let id = item.businessId;
                let status = 2;
                let name ='每月动态签发';
                this.$router.push({
                    name: 'monthly-issue',
                    params:{type,id:id,name},
                    query:{isIssue:status,proName:item.projectName,dynamicRiskOrderListName:item.riskName}
                })
            }else if(this.checkPoint1 == '待修订'){
                let data = {
                    businessId: item.businessId,
                    checkType:402,
                    tableType:4,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'revise';
                        let id = item.businessId;
                        let name ='每月动态修订';
                        this.$router.push({
                            name: 'monthly-revise',
                            params:{type,id,name}
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })

            }else if(this.checkPoint1 == '待接收'){
                let type = 'accept';
                let id = item.businessId;
                let name ='每月动态接收';
                this.$router.push({
                    name: 'monthly-accept',
                    params:{type,id:id,name},
                    query:{proName:item.projectName,dynamicRiskOrderListName:item.riskName}
                })
            }else if(this.checkPoint1 == '待配置'){
                let data = {
                    businessId: item.businessId,
                    checkType:501,
                    tableType:4,
                    remindType:1
                }
                this.$api.homeConterller.jumpCheck(data).then(res => {
                    if(res.code == 200){
                        let type = 'dispose';
                        let id = item.businessId;
                        let name ='每月动态配置';
                        this.$router.push({
                            name: 'monthly-dynamics-dispose',
                            params:{type,id,name}
                        })
                    }else{
                        this.$Message.error('权限变更，您已无法操作。');
                    }
                })


            }else{
                this.$router.push({
                    name: `monthly-dynamics`,
                })
            }
        ho}else if(this.active == '过程管控'){
            let id = item.businessId;
            this.$router.push({
                name: 'procedure-control-edit',
                params: {
                    id:id
                }
            })
        }
      },
      resizeTheChart(){
        this.$refs.e1.resize()
      },
    },
    mounted() {
      this.getRecentlyUseList();
      this.getMenuRecord();
      this.getMenuTree();
      this.getMessageNum();
      this.getChart();
      this.messageDetailList('businesstype_identification')
      this.noReadBusinessTypeCount()
      window.addEventListener("resize", this.resizeTheChart)
      this.statOverdueLevelCount()
    },
    created() {
      this.userInfo = getUserInLocalstorage()
    }

  }
</script>

<style scoped>
  .wenxun{
    border-radius: 5px;
    width: 100%;
    height: 128px;
    line-height: 128px;
    color: #fff;
    font-size: 24px;
    text-align: center;
  }
  .box{
    height:200px;
    padding:20px;
    background-color: #FAFBFD;
  }
  .box1{
    height:373px;
    padding:20px;
    background-color: #FAFBFD;
  }
  .blue{
    color:#0099FF
  }

  .col-height100 {
    padding:20px;
    height: 400px;
    border-right: 1px solid #ebeef1;
    overflow: auto;
  }
  .content{
    background-color: #F7F7F7;
  }
  .title{
    background-color: #F7F7F7;
    font-weight:bold;
  }
  .delete-Img{
    width:50%;

  }
  .title-box{
    height:150px;
    padding:6%  0 0 27%
  }
  .line{
    width: 2px;
    height:100px;
    padding-left:50%;
    border-right: solid #333333 0.5px;
  }
  .main-content-con1 {
    height: 100%;
    overflow: auto;
  }
  .header-con {
    background-color: #003b98;
    padding: 0 20px;
    width: 100%;
  }
  .title-size{
    font-size:14px;
    color:#677897;
    padding-top:10px;
    padding-left:10px;
  }
  .tabs{
    padding-left: 5%;
  }
  .img{
    float:left;
  }
  .icon-Img{
    padding:5% 3% 4% 7%;
    text-align: center;
    font-size:14px;
    cursor: pointer;
  }
  .userImg{
    width:60%;
  }

  .font{
    font-size:20px;
    color:#3071F2;
    display:block;
    float:left;
    line-height:40px;
    margin-left:40px;
  }
  .font1{
    font-size:20px;
    color:#EF3E43;
    display:block;
    float:left;
    line-height:40px;
    margin-left:40px;
  }
  .title-model{
    font-weight: bold;
    color:#000000;
  }
</style>
